#!/bin/bash

set -eux # -x for verbose logging to juju debug-log

# https://www.kagilum.com/documentation/install-guide/
# http://www.icescrum.org/en/
# http://en.wikipedia.org/wiki/Pip_(package_manager)
# https://pypi.python.org/pypi/pip

juju-log "III Getting any config parameters."

#szAcceptDataViaUdp=`config-get AcceptUdpConnections`
#szAcceptDataViaUdpDefault="True"

#if [ -z "$szAcceptDataViaUdp" ]
#then
#  szAcceptDataViaUdp="True"
#  juju-log "DDD Not set: AcceptUdpConnections, default to: $szAcceptDataViaUdp"
#else
#  # TODO make sure that it is only true or false, anything and it must got back to the default value.
#  juju-log "DDD AcceptUdpConnections: $szAcceptDataViaUdp"
#fi

##############################
# INSTALL SYSTEM DEPENDENCIES
#############################
juju-log "III Installing jdk and tomcat via apt-get"

apt-get -y install openjdk-7-jdk tomcat7 unzip

# TODO C wget icescrum
# md5sum -c sonar-3.6.2.zip.md5
# TODO verify the md5 is actually ok.
unzip -d /var/lib/tomcat7/webapps/ icescrum_R6_7.1_war.zip 

